package com.higgins.server.agentapp.datamodel;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import org.hibernate.annotations.GenericGenerator;

import com.higgins.client.agentapp.datamodel.AgencyDTO;
import com.higgins.client.agentapp.datamodel.JobSiteDTO;
import com.higgins.client.dataModel.CoveringLetterDTO;
import com.higgins.client.dataModel.StrategyDTO;

@Entity
@Table(name = "agency")
public class Agency {
    private Long id;
    private String name;
    private String address;
    private String phone;
    private String website;

    public Agency() {
        // This is used by JPA
    }
 
    @Id
    @GeneratedValue(generator = "increment")
    @GenericGenerator(name = "increment", strategy = "increment")
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
    public String getAddress() {
        return address;
    }
    public void setAddress(String address) {
        this.address = address;
    }
    
    public String getPhone()	{
    	return phone;
    }
    public void setPhone(String phone)	{
    	this.phone = phone;
    }
    
    public String getWebsite()	{
    	return website;
    }
    public void setWebsite(String website)	{
    	this.website = website;
    }
    
    public AgencyDTO toDTO()	{
    	AgencyDTO dto = new AgencyDTO();
    	dto.setId(id);
    	dto.setName(name);
    	dto.setAddress(address);
    	dto.setPhone(phone);
    	dto.setWebsite(website);
    	return dto;
    }
    public void update(AgencyDTO dto)	{
    	this.name = dto.getName();
    	this.address = dto.getAddress();
    	this.phone = dto.getPhone();
    	this.website = dto.getWebsite();
    }
}